package model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * Setting entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "setting", catalog = "clode")
public class Setting implements java.io.Serializable {

	// Fields

	private Integer id;
	private User user;
	private Compiler compiler;
	private String theme;

	// Constructors

	/** default constructor */
	public Setting() {
	}

	/** minimal constructor */
	public Setting(User user, Compiler compiler) {
		this.user = user;
		this.compiler = compiler;
	}

	/** full constructor */
	public Setting(User user, Compiler compiler, String theme) {
		this.user = user;
		this.compiler = compiler;
		this.theme = theme;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "compilerId", nullable = false)
	public Compiler getCompiler() {
		return this.compiler;
	}

	public void setCompiler(Compiler compiler) {
		this.compiler = compiler;
	}

	@Column(name = "theme", length = 50)
	public String getTheme() {
		return this.theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

}